package ink.tiptop.controller;

import ink.tiptop.dto.req.remote.restart.RestartServiceListRequest;
import ink.tiptop.dto.req.remote.restart.RestartServiceRequest;
import ink.tiptop.common.domain.rsp.Response;
import ink.tiptop.service.RestartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import ink.tiptop.utils.JSON;
/**
 * @author ink.tiptop.zjf
 * @Title: Ticket
 * @Package ink.tiptop.controller.remote
 * @Description: 发布维度的controller
 * @date 2020-07-30 21:32
 */
@Api("重启服务API")
@RestController
@RequestMapping("restartServiceController")
@Slf4j
public class RestartServiceController {

    /**
     * 服务对象
     */
    @Resource
    private RestartService restartService;

    /**
     *
     */
    @ApiOperation("查询重启列表入参")
    @PostMapping("list")
    @ResponseBody
    public Response list(@RequestBody @Valid RestartServiceListRequest request) {
        log.info("查询重启列表入参,入参:{}", JSON.toJSONString(request));
        return restartService.list(request);
    }

    /**
     *
     */
    @ApiOperation("重启服务入参")
    @PostMapping("restart")
    @ResponseBody
    public Response restart(@RequestBody @Valid RestartServiceRequest request) {
        log.info("重启服务入参,入参:{}", JSON.toJSONString(request));
        return restartService.restart(request);
    }


}
